package com.prj.ufdm.auth.enums;

/**
 * 授权模块返回码（编码规则：01 + 2位功能编号  + 3位错误编号）
 * @author 胡义振
 * @date 2018-03-18
 */
public enum AuthRetCodeEnum {
	
	RET_CODE_0101001("0101001","未登录"),
	RET_CODE_0101002("0101002","登录失败"),
	RET_CODE_0101003("0101003","注销成功"),
	RET_CODE_0101004("0101004","登录异常"),
	RET_CODE_0101005("0101005","Token不存在"),
	RET_CODE_0101006("0101006","Token验证异常"),
	RET_CODE_0101007("0101007","未授权"),
	RET_CODE_0101008("0101008","Token为空"),
	RET_CODE_0101009("0101009","Token超时"),
	
	RET_CODE_0102001("0102001","用户名不能为空"),
	RET_CODE_0102002("0102002","用户密码不能为空"),
	RET_CODE_0102003("0102003","用户名已存在"),
	RET_CODE_0102004("0102004","用户ID不能为空"),
	RET_CODE_0102005("0102005","用户ID不存在"),
	RET_CODE_0102006("0102006","老密码不能为空"),
	RET_CODE_0102007("0102007","原密码不正确"),
	
	RET_CODE_0103001("0103001","角色ID不能为空"),
	RET_CODE_0103002("0103002","功能ID不能为空"),

	
	RET_CODE_0199999("RET_CODE_0199999","其他错误");
	
	private String code;
	private String message;
	
	
	AuthRetCodeEnum(String code,String message){
		this.code = code;
		this.message = message;
	}
	
	public static String getRetCodeName(String retErrCode){
		String rtnRetErrCode = "";
		for (AuthRetCodeEnum authRetCodeEnum : AuthRetCodeEnum.values()) {
			if(authRetCodeEnum.code.equals(retErrCode)){
				rtnRetErrCode = authRetCodeEnum.message;
			}
	    }
		return rtnRetErrCode;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}


}
